; $VER: HomerInstaller 1.5 (14.05.96)

; =======================================================================
;   Set up some variables
; =======================================================================

(set OSVersion       (/ (getversion) 65536))
(set WBVersion       (/ (getversion "libs:version.library") 65536))
(set AGVersion       (/ (getversion "libs:amigaguide.library") 65536))
(set cpu             (database "cpu"))
(set #myaddress      "David Swasbrook,\nPO Box 54134,\nBucklands Beach,\nAuckland,\nNEW ZEALAND.\n" )
(set #welcome        "\nDoh!\n\nHomer enhances the functionality of your Workbench\n\n\nThis is Homer v1.5P\nPatched by (-nCo/tL!)" )




(message #welcome)
(welcome)


;
; ===== English
;
(set #kickstart "\nERROR : BAD VERSION OF KICKSTART\n\nHomer requires KickStart %s (V%ld) or higher. It will not work on earlier versions.\nYou currently are running KickStart V%ld.\n\n%s")
(set #goodbye "Homer is FREEWARE. If you really like this program you might want to tell me!")
(set #continue "Continue with installation?")
(set #aborted "Installation aborted!")
(set #yes "Yes")
(set #no "No")
(set #which-disk "Where would you like to install Homer? (A directory called Homer will be created here)")
(set #which-disk-help "\nThis section lets you choose where to install Homer on your hard disk.\n\n")
(set #doc-which-disk "Select directory to install documentation to")
;*** Messages
(set #msg_tooltypes "Setting tool types for current setup...")
;*** Errors
(set #err_CantMakeDirectory "An error has occured creating the Homer directory. Please check that the path you specified for installation to is valid!")
(set #err_CantFindDirectory "The path you specified to install to was not located. Please check that the path you specified for installation to is valid!")

; =======================================================================
;   Initialization
; =======================================================================

; ===== Make sure that we are running under the correct version of kickstart
(complete 0)(working #working_kickstart)
(set #minver-text (cat "2.1") )
(set minver 38)

(if (< OSVersion minver)
	(
	(set warning (#kickstart #minver-text minver OSVersion #aborted) )
	(abort warning)
	)
)


(if ( exists "Work:" (noreq) )
	(set @default-dest "Work:")
	(if ( exists "bin:" (noreq) )
		(set @default-dest "bin:")
		(set @default-dest "sys:")
	)
)


(complete 0)


; =======================================================================
;   Select target directory
; =======================================================================
(set target
    (askdir (prompt #which-disk)
        (help #which-disk-help @askdir-help)
        (default @default-dest)
    )
)

(if ( exists target (noreq) )
	(
		(set target (tackon target "Homer" ) )
		(if ( exists target (noreq) )
			(message "Installing over previous version...")
			(
				(makedir target (infos) )
				(if ( exists target (noreq) )
					(set dirmade 1 )
					(exit #err_CantMakeDirectory )
				)
			)
		)
	)
	(exit #err_CantFindDirectory)
)

(set @default-dest target)

(makeassign "Homer" target (safe))

(copyfiles
	(source "")
	(dest "Homer:")
	(choices "Homer" "Homer.conf" "HomerAnim.iff" "Homer.html" "HomerDict.iff" "HomerIcon.iff" )
	(infos)
)

(copyfiles
	(source "Samples")
	(dest "Homer:Samples")
	(all)
)

(copylib
	(prompt "Matrix.Library")
	(help "Help")
	(source "libs/matrix.library")
	(dest "libs:")
	(confirm)
)
(copylib
	(prompt "SwazConfig.Library")
	(help "Help")
	(source "libs/swazconfig.library")
	(dest "libs:")
	(confirm)
)


(complete 95)(working #msg_tooltypes)		; ===== Change icon tool types

(tooltype	(dest "Homer:Homer")
	(settooltype "PROGDIR" target )
	(settooltype "DONOTWAIT" )
)

;** 
;** (complete 100)
;** 
;** 
;** 
;** 

(makeassign "Homer" (safe))

(exit #goodbye #myaddress)

; 
; (-nCo/tL!) pATCHEd tHIs sUCKEr ....
; 
